home *** CD-ROM | disk | FTP | other *** search
- Path: sdrc.com!thor!scjones
- From: larry.jones@sdrc.com (Larry Jones)
- Newsgroups: comp.lang.c,comp.lang.c++,gnu.gcc.help,gnu.g++.help,comp.os.msdos.djgpp
- Subject: Re: float != float and floats as return types
- Date: 31 Jan 1996 18:25:23 GMT
- Organization: SDRC Engineering Services
- Distribution: world
- Message-ID: <4eoc6j$8vi@info1.sdrc.com>
- References: <4ej9lb$mpc@fu-berlin.de> <310D4D9C.7DAB2E1B@alcyone.com> <310DF403.2EDA7BBD@alcyone.com>
- NNTP-Posting-Host: thor.sdrc.com
- Originator: scjones@thor
-
- In article <310DF403.2EDA7BBD@alcyone.com>, Erik Max Francis <max@alcyone.com> writes:
- > Russell Blackadar wrote:
- >
- > > What is surprising is that all the columns are not zero! The original poster
- > > was offering some speculations as to how that might have happened, but as you
- > > say (and I think he'd agree) it doesn't wash. I ran his posted code and
- > > got all zeroes. Either there's a *serious* problem with his compiler, or the
- > > posted code is not the same as what he compiled.
- >
- > Not at all. Systematic errors are expected when using floating point
- > computations.
- >
- > Under gcc 2.6.3 for Linux, his program prints the following:
-
- Making gcc an ANSI/ISO Standard conforming compiler is trickier than it
- seems -- the required options are neither simple nor obvious. This is
- particularly true in places like floating point arithmetic where people
- are generally less concerned with getting the exactly ``correct''
- results (i.e., what the standard says you should get) than they are
- with getting reasonably correct results fast.
-
- In particular, the standard generally allows a compiler to compute
- floating point results with more precision than it requires, but there
- are a number of places where it requires any excess precision to be
- removed. gcc generally does not remove the excess precision in those
- cases. Specifying -ffloat-store helps; on i386/i486 machines so does
- -mno-fp-ret-in-387; but, as far as I can tell, there is no way (as of
- gcc 2.7.1) to make gcc conform completely on i386/i486 machines as there
- is no way to force it to remove precision as a result of a cast.
- ----
- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
- larry.jones@sdrc.com
- I like maxims that don't encourage behavior modification. -- Calvin
-